bitkeeper revision 1.1327 (42650c157OdzpVLoIU2uHsYHltTfYg)
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Tue, 19 Apr 2005 13:48:05 +0000 (13:48 +0000)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Tue, 19 Apr 2005 13:48:05 +0000 (13:48 +0000)
Remove unused VERIFY_READ and VERIFY_WRITE parameters from the
access_ok, user-space memory check macros.
Signed-off-by: Keir Fraser <keir@xensource.com>
xen/arch/x86/mm.c
xen/arch/x86/traps.c
xen/arch/x86/x86_32/usercopy.c
xen/arch/x86/x86_64/usercopy.c
xen/common/dom_mem_ops.c
xen/common/grant_table.c
xen/common/multicall.c
xen/common/physdev.c
xen/include/asm-x86/x86_32/uaccess.h
xen/include/asm-x86/x86_64/uaccess.h

index 4bfe7bacd22f04109d6406383ee13a8521fb3c77..2b8f813920e0ea425c530548a91a68a16a0d99c9 100644 (file)
@@ -1464,7 +1464,7 @@ int do_mmuext_op(
         goto out;
     }
 
-    if ( unlikely(!array_access_ok(VERIFY_READ, uops, count, sizeof(op))) )
+    if ( unlikely(!array_access_ok(uops, count, sizeof(op))) )
     {
         rc = -EFAULT;
         goto out;
@@ -1644,7 +1644,7 @@ int do_mmuext_op(
             unsigned long ents = op.nr_ents;
             if ( ((ptr & (PAGE_SIZE-1)) != 0) || 
                  (ents > 8192) ||
-                 !array_access_ok(VERIFY_READ, ptr, ents, LDT_ENTRY_SIZE) )
+                 !array_access_ok(ptr, ents, LDT_ENTRY_SIZE) )
             {
                 okay = 0;
                 MEM_LOG("Bad args to SET_LDT: ptr=%p, ents=%p", ptr, ents);
@@ -1819,7 +1819,7 @@ int do_mmu_update(
     perfc_addc(num_page_updates, count);
     perfc_incr_histo(bpt_updates, count, PT_UPDATES);
 
-    if ( unlikely(!array_access_ok(VERIFY_READ, ureqs, count, sizeof(req))) )
+    if ( unlikely(!array_access_ok(ureqs, count, sizeof(req))) )
     {
         rc = -EFAULT;
         goto out;
@@ -2591,7 +2591,7 @@ static int ptwr_emulated_update(
     struct domain *d = current->domain;
 
     /* Aligned access only, thank you. */
-    if ( !access_ok(VERIFY_WRITE, addr, bytes) || ((addr & (bytes-1)) != 0) )
+    if ( !access_ok(addr, bytes) || ((addr & (bytes-1)) != 0) )
     {
         MEM_LOG("ptwr_emulate: Unaligned or bad size ptwr access (%d, %p)\n",
                 bytes, addr);
index 39a93641ef4616279736887cd06db847e63991ce..b819a79f499d4428a9821dc0f9adcbf264889010 100644 (file)
@@ -1105,25 +1105,25 @@ long set_debugreg(struct exec_domain *p, int reg, unsigned long value)
     switch ( reg )
     {
     case 0: 
-        if ( !access_ok(VERIFY_READ, value, sizeof(long)) )
+        if ( !access_ok(value, sizeof(long)) )
             return -EPERM;
         if ( p == current ) 
             __asm__ ( "mov %0, %%db0" : : "r" (value) );
         break;
     case 1: 
-        if ( !access_ok(VERIFY_READ, value, sizeof(long)) )
+        if ( !access_ok(value, sizeof(long)) )
             return -EPERM;
         if ( p == current ) 
             __asm__ ( "mov %0, %%db1" : : "r" (value) );
         break;
     case 2: 
-        if ( !access_ok(VERIFY_READ, value, sizeof(long)) )
+        if ( !access_ok(value, sizeof(long)) )
             return -EPERM;
         if ( p == current ) 
             __asm__ ( "mov %0, %%db2" : : "r" (value) );
         break;
     case 3:
-        if ( !access_ok(VERIFY_READ, value, sizeof(long)) )
+        if ( !access_ok(value, sizeof(long)) )
             return -EPERM;
         if ( p == current ) 
             __asm__ ( "mov %0, %%db3" : : "r" (value) );
index 7e479bbee81f9234d924d8104f2d94ad258ffe43..f26d916bab846a541b7084cd40dde1321a19ab9e 100644 (file)
@@ -59,7 +59,7 @@ do {                                                                  \
 unsigned long
 clear_user(void __user *to, unsigned long n)
 {
-       if (access_ok(VERIFY_WRITE, to, n))
+       if (access_ok(to, n))
                __do_clear_user(to, n);
        return n;
 }
@@ -410,7 +410,7 @@ __copy_from_user_ll(void *to, const void __user *from, unsigned long n)
 unsigned long
 copy_to_user(void __user *to, const void *from, unsigned long n)
 {
-       if (access_ok(VERIFY_WRITE, to, n))
+       if (access_ok(to, n))
                n = __copy_to_user(to, from, n);
        return n;
 }
@@ -434,7 +434,7 @@ copy_to_user(void __user *to, const void *from, unsigned long n)
 unsigned long
 copy_from_user(void *to, const void __user *from, unsigned long n)
 {
-       if (access_ok(VERIFY_READ, from, n))
+       if (access_ok(from, n))
                n = __copy_from_user(to, from, n);
        else
                memset(to, 0, n);
index 839d2582a5db4cd37146817d2be134018784f6bb..547cacc91b39a77ada9fe4a35bb72ea8bb228610 100644 (file)
@@ -127,7 +127,7 @@ __copy_from_user_ll(void *to, const void __user *from, unsigned n)
 
 unsigned long clear_user(void *to, unsigned long n)
 {
-       if (access_ok(VERIFY_WRITE, to, n))
+       if (access_ok(to, n))
                return __clear_user(to, n);
        return n;
 }
@@ -148,7 +148,7 @@ unsigned long clear_user(void *to, unsigned long n)
 unsigned long
 copy_to_user(void __user *to, const void *from, unsigned n)
 {
-       if (access_ok(VERIFY_WRITE, to, n))
+       if (access_ok(to, n))
                n = __copy_to_user(to, from, n);
        return n;
 }
@@ -172,7 +172,7 @@ copy_to_user(void __user *to, const void *from, unsigned n)
 unsigned long
 copy_from_user(void *to, const void __user *from, unsigned n)
 {
-       if (access_ok(VERIFY_READ, from, n))
+       if (access_ok(from, n))
                n = __copy_from_user(to, from, n);
        else
                memset(to, 0, n);
index e8e3b7b25621075937d9218c58ae9208f9740173..3d55f4b8af4873f5406302abc48ca631d8d6ce4a 100644 (file)
@@ -41,8 +41,8 @@ alloc_dom_mem(struct domain *d,
     struct pfn_info *page;
     unsigned long    i;
 
-    if ( unlikely(!array_access_ok(VERIFY_WRITE, extent_list, 
-                                   nr_extents, sizeof(*extent_list))) )
+    if ( unlikely(!array_access_ok(extent_list, nr_extents,
+                                   sizeof(*extent_list))) )
         return start_extent;
 
     if ( (extent_order != 0) && !IS_CAPABLE_PHYSDEV(current->domain) )
@@ -79,8 +79,8 @@ free_dom_mem(struct domain *d,
     struct pfn_info *page;
     unsigned long    i, j, mpfn;
 
-    if ( unlikely(!array_access_ok(VERIFY_READ, extent_list, 
-                                   nr_extents, sizeof(*extent_list))) )
+    if ( unlikely(!array_access_ok(extent_list, nr_extents,
+                                   sizeof(*extent_list))) )
         return start_extent;
 
     for ( i = start_extent; i < nr_extents; i++ )
index 4e2c93c95c503be7f1e1f5ba5698dd4e96dc25a1..c0c99481e75ed70c58af4712076f8c6afc3ae879 100644 (file)
@@ -812,13 +812,13 @@ do_grant_table_op(
     {
     case GNTTABOP_map_grant_ref:
         if ( unlikely(!array_access_ok(
-            VERIFY_WRITE, uop, count, sizeof(gnttab_map_grant_ref_t))) )
+            uop, count, sizeof(gnttab_map_grant_ref_t))) )
             goto out;
         rc = gnttab_map_grant_ref((gnttab_map_grant_ref_t *)uop, count);
         break;
     case GNTTABOP_unmap_grant_ref:
         if ( unlikely(!array_access_ok(
-            VERIFY_WRITE, uop, count, sizeof(gnttab_unmap_grant_ref_t))) )
+            uop, count, sizeof(gnttab_unmap_grant_ref_t))) )
             goto out;
         rc = gnttab_unmap_grant_ref((gnttab_unmap_grant_ref_t *)uop, count);
         break;
index cbdf20b63e9001b9a939f5502a13e52eea4eee49..c6515d7a9b58ef6532137a32a1ceba019da5af3c 100644 (file)
@@ -24,8 +24,7 @@ long do_multicall(multicall_entry_t *call_list, unsigned int nr_calls)
         return -EINVAL;
     }
 
-    if ( unlikely(!array_access_ok(VERIFY_WRITE, call_list, 
-                                   nr_calls, sizeof(*call_list))) )
+    if ( unlikely(!array_access_ok(call_list, nr_calls, sizeof(*call_list))) )
     {
         DPRINTK("Bad memory range %p for %u*%u bytes.\n",
                 call_list, nr_calls, sizeof(*call_list));
index a1f182e8c8794e21f7c7623b4cb85245450b73c3..de3bd331a11fdd9b169e67f85a61b304006e718e 100644 (file)
@@ -712,7 +712,7 @@ long do_physdev_op(physdev_op_t *uop)
 
     case PHYSDEVOP_SET_IOBITMAP:
         ret = -EINVAL;
-        if ( !access_ok(VERIFY_READ, op.u.set_iobitmap.bitmap, IOBMP_BYTES) ||
+        if ( !access_ok(op.u.set_iobitmap.bitmap, IOBMP_BYTES) ||
              (op.u.set_iobitmap.nr_ports > 65536) )
             break;
         ret = 0;
index c875666d655659fc543db2f3e0dbcd0e438e557c..c3e129d785b00fc2fc33184c564308f3969f7822 100644 (file)
@@ -11,9 +11,6 @@
 
 #define __user
 
-#define VERIFY_READ 0
-#define VERIFY_WRITE 1
-
 /*
  * movsl can be slow when source and dest are not both 8-byte aligned
  */
@@ -39,10 +36,10 @@ extern struct movsl_mask {
                :"1" (addr),"g" ((int)(size)),"r" (HYPERVISOR_VIRT_START)); \
        flag; })
 
-#define access_ok(type,addr,size) (likely(__range_not_ok(addr,size) == 0))
+#define access_ok(addr,size) (likely(__range_not_ok(addr,size) == 0))
 
-#define array_access_ok(type,addr,count,size) \
-    (likely(count < (~0UL/size)) && access_ok(type,addr,count*size))
+#define array_access_ok(addr,count,size) \
+    (likely(count < (~0UL/size)) && access_ok(addr,count*size))
 
 extern long __get_user_bad(void);
 extern void __put_user_bad(void);
index bb23ae81a4456cc5f76ee741b71f944485c7300f..d655e01f83b077bceedb18f9a3124e8a30c35262 100644 (file)
@@ -12,9 +12,6 @@
 
 #define __user
 
-#define VERIFY_READ 0
-#define VERIFY_WRITE 1
-
 /*
  * Valid if in +ve half of 48-bit address space, or above Xen-reserved area.
  * This is also valid for range checks (addr, addr+size). As long as the
@@ -25,9 +22,9 @@
     (((unsigned long)(addr) < (1UL<<48)) || \
      ((unsigned long)(addr) >= HYPERVISOR_VIRT_END))
 
-#define access_ok(type, addr, size) (__addr_ok(addr))
+#define access_ok(addr, size) (__addr_ok(addr))
 
-#define array_access_ok(type,addr,count,size) (__addr_ok(addr))
+#define array_access_ok(addr, count, size) (__addr_ok(addr))
 
 extern long __get_user_bad(void);
 extern void __put_user_bad(void);